package common.generic.demo1;

import java.time.Period;

/**
 * @author: kanggw
 * @date: 2022/3/15
 * @DESCRIPTION:
 */
public class MethedTest {

    public static void main(String[] args) {
        Student person = MethedTest.obtainPerson();

        System.out.println(person.getName());
        System.out.println(person.getClasses());

         Teacher person1 = (Teacher) getPerson();
        System.out.println(person1.getLevel());
    }

    public static  <T extends Person> T obtainPerson() {

        Student s = new Student();
        s.setName("zhang san");
        return (T) s;
    }

    public static Person getPerson() {

        Teacher s = new Teacher();
        s.setName("zhang san");
        s.setLevel("one");
        return s;
    }
}
